package com.Guigu.controller;

import com.Guigu.domain.ResponseResult;
import com.Guigu.domain.User;
import com.Guigu.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;
    @PostMapping("/user/login")
//    @PreAuthorize("hasAnyAuthority('system:dept:list')")
    public ResponseResult login(@RequestBody User user){
        //登录
        return loginService.login(user);
    }
    //退出登录
    @GetMapping("/user/logout")
    public ResponseResult logout(){
        return loginService.logout();
    }
}
